<template>
  <div>
    <lz-tree-select
      ref="lzTreeSelect"
      :replaceFields="{
        key: 'id',
        value: 'id',
        title: 'cateName',
        children: 'children',
      }"
      v-model="treeSelect"
      @change="lzTreeSelectChange"
      :multiple="false"
      :asyncLoad="asyncLoad"
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      treeSelect: ["1303143567715205120", "1303143576716181504"],
    };
  },
  created() {},
  mounted() {},
  methods: {
    lzTreeSelectChange(val) {
      console.log(val);
      console.log(this.treeSelect);
    },
    asyncLoad({ id }) {
      return new Promise((resolve) => {
        this.$axios({
          url: "http://localhost:7001/api/brand/pc/brand/display/cate/getTree",
          params: { pid: id },
        }).then((res) => {
          resolve(res.data);
        });
      });
    },
  },
};
</script>
<style></style>
